using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using Less.SRV;
using Less.Core;
using Less.Core.Model;

namespace Less.REST
{
    [ServiceContract(Name = "Log")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class LogREST : LogSRV
    {
        public LogREST()
        : base("lessConnection")
        {
        }

        [WebGet(UriTemplate = "", ResponseFormat = WebMessageFormat.Json)]
        public new List<LogEntry> GetAll()
        {
            return Web.Templates.FunctionTemplate(base.GetAll, EntryCategories.REST);
        }

        [WebGet(UriTemplate = "?minSeverity={minSeverity}", ResponseFormat = WebMessageFormat.Json)]
        public new List<LogEntry> GetBySeverity(EntrySeverities minSeverity)
        {
            return Web.Templates.FunctionTemplate(base.GetBySeverity, minSeverity);
        }
    }
}